package com.demo.service.impl;

import com.demo.common.model.BaseQuery;
import com.demo.vo.UserDetailVo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.demo.mapper.UserMapper;
import com.demo.entity.User;
import com.demo.service.UserService;
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService{
    @Autowired
    private UserMapper userMapper;

    @Override
    public UserDetailVo queryUserDetailInfoByUserId(Integer loginUserId) {
        return userMapper.queryUserDetailInfoByUserId(loginUserId);
    }

    @Override
    public PageInfo<User> queryUserHelperPage(Integer current, Integer pageSize) {
        // 1、设置分页
        PageHelper.startPage(current,pageSize);
        // 2、查询所有用户列表
        List<User> list = userMapper.selectUserList(new BaseQuery());
        // 3、创建分页对象
        PageInfo<User> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
}
